
#include <VolumeUnit.h>

VolumeUnit::VolumeUnit(int factor, const char* name):Unit(factor, name)
{
}

const VolumeUnit* VolumeUnit::getTsp()
{
    static const VolumeUnit tsp(TSP_TO_BASEUNIT, "TSP");
    return &tsp;
}

const VolumeUnit* VolumeUnit::getTbsp()
{
    static const VolumeUnit tbsp(TBSP_TO_BASEUNIT, "TBSP");
    return &tbsp;
}

const VolumeUnit* VolumeUnit::getOz()
{
    static const VolumeUnit oz(OZ_TO_BASEUNIT, "OZ");
    return &oz;
}

std::list<const Unit*> VolumeUnit::getVolumeUnitList()
{
    static std::list<const Unit*> volumeUnitList;
    if (volumeUnitList.empty())
    {
        volumeUnitList.push_back(OZ);
        volumeUnitList.push_back(TBSP);
        volumeUnitList.push_back(TSP);
    }
    return volumeUnitList;
}

void VolumeUnit::output(int amount, std::ostream& stream, const Unit* unit)
{
    Unit::formatOutput(amount, stream, unit, getVolumeUnitList());
}
